import { cloudService } from './index'
import { IPeriodDay, IPeriodSetting } from '@/types/period.ts'


export const updatePeriodDayApi = (id: number, periodDay: IPeriodDay): Promise<boolean> =>
  cloudService({
    url: `/home-api/period/day/${id}`,
    method: 'put',
    data: periodDay
  })

export const queryPeriodDayApi = (month: string): Promise<IPeriodDay[]> =>
  cloudService({
    url: '/home-api/period/day',
    method: 'get',
    params: { month }
  })

export const getMenstruateFirstDateApi = (month: string): Promise<string> =>
  cloudService({
    url: '/home-api/period/menstruate',
    method: 'get',
    params: { month }
  })

export const updatePeriodSettingApi = (id: number, setting: IPeriodSetting): Promise<boolean> =>
  cloudService({
    url: `/home-api/period/setting/${id}`,
    method: 'put',
    data: setting
  })

export const queryPeriodSettingApi = (): Promise<IPeriodSetting> =>
  cloudService({
    url: '/home-api/period/setting',
    method: 'get'
  })
